package cn.unknowpupil.init.service.system;

import cn.unknowpupil.init.domain.dto.EmailDto;
import cn.unknowpupil.init.domain.system.SysEmail;
import cn.unknowpupil.init.domain.vo.EmailVo;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.service.IService;

/**
 * Created at 2020-11-04 by  w10g <br>
 * Initialize SysEmail  ... <br>
 *  邮件配置表 核心业务处理接口
 *
 * @author unknowpupil
 * @since 0.0.1
 */
public interface ISysEmailService extends IService<SysEmail> {
        /**
         *  新增
         * @param sysEmail {@link SysEmail}  邮件配置表
         * @return {@link SysEmail}
         */
        boolean create(SysEmail sysEmail);

        /**
         *  详情
         * @param id {@code Long}   SysEmail ID
         * @return {@link SysEmail}
         */
        SysEmail info(Long id);

        /**
         *  删除
         * @param ids {@code Long}   SysEmail ID
         * @return {@link SysEmail}
         */
        boolean delete(Long[] ids);


        /**
         *  修改
         * @param sysEmail {@link SysEmail}  邮件配置表
         * @return {@link SysEmail}
         */
        boolean update(SysEmail sysEmail);


        /**
         * 分页
         * @param current {@code int} 页码
         * @param size {@code int} 笔数
         * @param sysEmail {@link SysEmail}
         * @return {@code IPage<SysEmail>}
         */
        IPage<SysEmail> page(int current, int size, SysEmail sysEmail);





        /**
         * 发送邮件
         * @param emailVo 邮件发送的内容
         * @param sysEmail 邮件配置
         * @throws Exception /
         */
        void send(EmailVo emailVo, SysEmail sysEmail);

        /**
         * 查找开启的邮件配置
         * @return
         */
        SysEmail find();

        /**
         * 发送邮件配置
         * @param email
         * @param key
         * @return
         */
        EmailVo sendEmail(String email, String key);

        /**
         * 验证
         * @param code /
         * @param key /
         */
        void validated(String key, String code);

        /**
         * 修改开启状态
         * @param sysEmail
         * @return
         */
        boolean changeStatus(SysEmail sysEmail);

        /**
         * 测试发送
         * @param emailDto
         * @return
         */
        EmailVo sendEmail(EmailDto emailDto);
}
